random_string() {
    len=$1
    re='^[0-9]+$'
    if ! [[ $len =~ $re ]]; then
        echo "需要传入位数"
        return
    fi
    if ! which md5sum >/dev/null 2>&1; then
        if [ "$(uname)" == "Darwin" ]; then
            # macos
            echo "md5sum not installed, run 'brew install md5sha1sum' to install"
            return
        fi
    fi
    res=$(date +%s%N | md5sum | cut -c 1-$len)
    echo $res
}
n=e
a=$(random_string $n)
echo $a

function set_flutter_mirror() {

    gradle_file_path="$(dirname $(dirname $(which flutter)))/packages/flutter_tools/gradle/flutter.gradle"

    sed -i "s/google()/maven { url 'https://maven.aliyun.com/repository/google' }/" "$gradle_file_path"

    sed -i "s/mavenCentral()/maven { url 'https://maven.aliyun.com/repository/jcenter' }/" $gradle_file_path

}
